﻿@inject IJSRuntime JSRuntime
<h3>测试TimChen44的blazor-charts库</h3>
<BcChart Height="400" Width="800" Data="githubs" CategoryField="x=>x.Year.ToString()">
    <BcTitle Title="图表示例" TData="Github"></BcTitle>
    <BcAxesY TData="Github" GridLineMajor="true" GridLineMinor="true"></BcAxesY>
    <BcLegend TData="Github" BorderWidth="1" Position="LegendPosition.Bottom"></BcLegend>
    <BcColumnSeries TData="Github" ValueFunc="x=>x.Sum(y=>y.View)" GroupName="View"></BcColumnSeries>
    <BcColumnSeries TData="Github" ValueFunc="x=>x.Sum(y=>y.Start)" GroupName="Start"></BcColumnSeries>
    <BcLineSeries TData="Github" ValueFunc="x=>x.Sum(y=>y.Fork)" GroupName="Fork" IsSecondaryAxis="true"></BcLineSeries>
</BcChart>

@code {
    //https://github.com/TimChen44/blazor-charts
    //Nuget BlazorCharts, TimChen44
    string title = "图表示例";

    List<Github> githubs = new List<Github>()
    {
        new Github(){Year=2017,View =2500,Start=800,Fork=400},
        new Github(){Year=2018,View =2200,Start=900,Fork=800},
        new Github(){Year=2019,View =2800,Start=1100,Fork=700},
        new Github(){Year=2020,View =2600,Start=1400,Fork=900},
    };


    public class Github
    {
        public int Year { get; set; }
        public int View { get; set; }
        public int Start { get; set; }
        public int Fork { get; set; }
    }
}